<template>
  <div class="container">
    <div>
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
      >
        <el-tab-pane
          label="静态收益"
          name="static_income"
        ></el-tab-pane>
        <el-tab-pane
          label="动态收益"
          name="dynamic_income"
        ></el-tab-pane>
        <el-tab-pane
          label="团队奖励"
          name="team_bonus"
        ></el-tab-pane>
        <el-tab-pane
          label="提现手续费"
          name="withdraw"
        ></el-tab-pane>
        <el-tab-pane
          label="转账手续费"
          name="transfer"
        ></el-tab-pane>
      </el-tabs>
    </div>
    <div
      style="margin-top:20px"
      class=""
    >
      <el-table
        :data="tableData"
        :border='true'
        :key="activeName"
        v-if="activeName != 'withdraw' && activeName != 'transfer'"
       >
        <template v-if="activeName == 'static_income'">
          <el-table-column
            align="center"
            prop="level"
            label="等级"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="point_exchange_rate"
            label="倍数"
          ></el-table-column>
        </template>
        <template v-if="activeName == 'dynamic_income'">
          <el-table-column
            align="center"
            prop="direct_inferior_count"
            label="人数"
          ></el-table-column>
          <el-table-column
            align="center"
            label="收益"
          >
            <template
              v-show="scope.row.income_rate"
              slot-scope="scope"
            >
              <span
                style="margin-right:20px"
                v-for="(item,index) in scope.row.income_rate"
              >{{item}}</span>
            </template>
          </el-table-column>
        </template>
        <template v-if="activeName == 'team_bonus'">
          <el-table-column
            align="center"
            prop="inferior_count"
            label="人数"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="performance"
            label="总业绩"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="income_rate"
            label="收益率"
          ></el-table-column>
        </template>
      </el-table>
      <ul v-if="activeName == 'withdraw'" class="company-num-list flex-box-align mb30">
        <li class="flex">
          <div class="li-top">提现手续费</div>
          <div>{{tableData.balance_loss_rate}}</div>
        </li>
      </ul>
      <ul v-if="activeName == 'transfer'" class="company-num-list flex-box-align mb30">
        <li class="flex">
          <div class="li-top">上级转账手续费</div>
          <div>{{tableData.superior_balance_loss_rate}}</div>
        </li>
        <li class="flex">
          <div class="li-top">下级转账手续费</div>
          <div>{{tableData.inferior_balance_loss_rate}}</div>
        </li>
        <li class="flex">
          <div class="li-top">上级转账点券比例</div>
          <div>{{tableData.superior_coupon_exchange_rate}}</div>
        </li>
        <li class="flex">
          <div class="li-top">下级转账点券比例</div>
          <div>{{tableData.inferior_coupon_exchange_rate}}</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
let CONSTANT = require("../constant/constant.js");
let common = require("../common.js");
import TableList from "./common/my-table";
export default {
  data() {
    return {
      activeName: "static_income",
      tableArr: [],
      tableData: []
    };
  },
  components: {},
  watch: {},
  created() {},
  mounted() {
    this.getInfo();
  },
  methods: {
    getInfo: function() {
      let url = CONSTANT.URL.SETTINGINFO,
        data = {};
      common.requestGetAjax(url, {}, data, res => {
        let arr = res.data;
        this.tableArr = arr;
        arr.map(item => {
          if (item.item == "static_income") {
            this.tableData = item.config;
          }
        });
      });
    },
    handleClick(val) {
      this.activeName = val.name;
      this.tableArr.map(item => {
        if (item.item == this.activeName) {
          this.tableData = item.config;
        }
      });
      console.log(this.tableData);
    }
  }
};
</script>

<style lang="scss">
.container {
  .company-num-list {
    li {
      cursor: pointer;
      height: 193px;
      background-color: #fff;
      box-shadow: 2px 2px 1px rgba(15, 5, 9, 0.1);
      border-left: 1px solid rgba(15, 5, 9, 0.1);
      margin-right: 1.3%;
      text-align: center;
      border-radius: 10px;
      margin-top: 25px;
      .li-top {
        height: 44px;
        font-size: 16px;
        color: #ffffff;
        line-height: 44px;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
      }
      div:nth-child(2) {
        font-size: 40px;
        line-height: 150px;
        color: #000000;
      }
    }
    li:nth-child(1) {
      div:nth-child(1) {
        background: linear-gradient(to right, #838efe, #00e9ff);
      }
    }
    li:nth-child(2) {
      div:nth-child(1) {
        background: linear-gradient(to right, #ff5454, #ffa0a0);
      }
    }
    li:nth-child(3) {
      div:nth-child(1) {
        background: linear-gradient(to right, #d6a615, #e6d7a9);
      }
    }
    li:nth-child(4) {
      div:nth-child(1) {
        background: linear-gradient(to right, #f47721, #f8b88b);
      }
    }
    li:nth-child(5) {
      div:nth-child(1) {
        background: linear-gradient(to right, #547cff, #a0caff);
      }
    }
    li:nth-child(6) {
      div:nth-child(1) {
        background: linear-gradient(to right, #55df3e, #b6ffaa);
      }
    }
  }
  .el-table__row {
    .cell {
      button {
        margin-top: 10px;
      }
    }
    video {
      width: 100px;
      height: auto;
    }
    img.video-img {
      width: 60px;
      height: 60px;
      cursor: pointer;
      border-radius: 30px;
    }
  }
  .pagination {
    text-align: center;
    width: 80%;
    margin-top: 60px;
  }
  .el-dialog__body {
    img {
      display: block;
      margin: 0 auto;
    }
  }
  .user-num {
    color: #409eff;
    cursor: pointer;
  }

  .avatar {
    width: 50px !important;
    height: 50px;
    border-radius: 50%;
    -webkit-border-radius: 50%;
  }
}
</style>
